﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace commonV2.forms
{
    public partial class ErrorForm : Form
    {
        public ErrorForm()
        {
            InitializeComponent();

        }
        bool fullMode
        {
            get
            {
                return detailErrorEd.Visible;
            }
            set
            {
                detailErrorEd.Visible = value;
                this.Height = detailErrorEd.Location.Y + 2 * SystemInformation.CaptionHeight+20;
                if (value) this.Height += detailErrorEd.Height;
                //detailBtn.Text = (value?language.GetString("less"):language.GetString("more"));
            }
        }
        public void ShowError(string error, string detailError)
        {
            SetLanguage(); 
            errorLbl.Text = error;
            detailErrorEd.Text = detailError;
            fullMode = true;
            ShowDialog();
        }

        private void detailBtn_Click(object sender, EventArgs e)
        {
            fullMode = !fullMode;
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        public virtual void SetLanguage() 
        {
            this.Text = language.GetString("sysError");
            okBtn.Text = language.GetString("ok");
        }
    }
}
